﻿#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
using namespace std;

class Animal {
public:
	virtual void speak() {
		cout << "Animal speak" << endl;
	}
};

class Dog : public Animal {
public:
	virtual void speak() {
		cout << "Dog speak" << endl;
	}
};

void test01() {
	Dog g;
	Animal &a = g; 
	a.speak(); // Dog speak 
}

int main()
{

	test01(); 

	system("pause");
	return EXIT_SUCCESS;
}